package com.yqg.education.mapper;

import com.yqg.education.entity.TrainSign;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 张芸博
 * @since 2025-04-10
 */
@Mapper
public interface TrainSignMapper extends BaseMapper<TrainSign> {

    List<TrainSign> findPage(Integer pageNum, Integer pageSize, String username, String courseName, String periodName, Integer flow, Integer stuId);

    Long findCount(String username, String courseName, String periodName, Integer flow, Integer stuId);

    Long stuFindIsTrainSign(@Param("periodId") Long periodId,
                           @Param("stuId") Long stuId);

    Long stuUpdateTrainSignFlow(@Param("periodId") Integer periodId, @Param("stuId") Integer stuId);

    /**
     *  根据classID获取本班级对应课程的签到率
     * @param classId 课程ID
     * @return map（courseId（课程Id），courseName（课程名称）,actualSign（实际签到人数）,requiredSign（应该签到人数））组成的list集合
     */
    @MapKey("courseId")
    List<Map<String, Object>> getSignRate(@Param("classId") Long classId);
}
